<!DOCTYPE html>
<html lang="en">
<head>
    {% load staticfiles %}
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <title>小智状态{{ device_id }}</title>
    <!-- 新 Bootstrap 核心 CSS 文件 -->
    <link rel="stylesheet" href="http://cdn.bootcss.com/bootstrap/3.3.0/css/bootstrap.css">

    <!-- 可选的Bootstrap主题文件（一般不用引入） -->
    <link rel="stylesheet" href="http://cdn.bootcss.com/bootstrap/3.3.0/css/bootstrap-theme.min.css">
    <link rel="stylesheet" href={%static 'css/style.css'%}>
    <!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
    <script src="http://cdn.bootcss.com/jquery/1.11.1/jquery.min.js"></script>

    <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
    <script src="http://cdn.bootcss.com/bootstrap/3.3.0/js/bootstrap.min.js"></script>

    <script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
</head>
<body>
<div class="container">
    <div class="xz-camera row">
暂无视频源
    </div>
    操作
    <div class="row">
        <ul class="list-group">
            <li class="list-group-item" id="lightBtn">
            <span class="xz-list-icon glyphicon glyphicon-flash"></span>
            <span class="xz-list-title">照明</span>
            </li>
            <li class="list-group-item" id="waterBtn">
            <span class="xz-list-icon glyphicon glyphicon-flash"></span>
            <span class="xz-list-title">上水</span>
            </li>
            <li class="list-group-item" id="dryBtn">
            <span class="xz-list-icon glyphicon glyphicon-flash"></span>
            <span class="xz-list-title">放水</span>
            </li>
            <li class="list-group-item" id="seedBtn">
            <span class="xz-list-icon glyphicon glyphicon-flash"></span>
            <span class="xz-list-title">更换种子</span>
            </li>
        </ul>
    </div>
</div>
</body>
<script>

    alert('{{wx_cfg.timestamp}} || {{wx_cfg.nonceStr}} || {{wx_cfg.signature}}')
    var wx_cfg = {
        debug: false,
        appId: 'wxc933621a5d3df147',
        timestamp: {{wx_cfg.timestamp}},
        nonceStr: '{{wx_cfg.nonceStr}}',
        signature: '{{wx_cfg.signature}}',
        beta: true,
        jsApiList: [
            'openWXDeviceLib',
            'getWXDeviceTicket',
            'configWXDeviceWiFi'
        ]
    }
    var str = JSON.stringify(wx_cfg);
    alert('wx_cfg' + str)

    wx.config(wx_cfg);

    wx.error(function (res) {
        var str = JSON.stringify(res);
        alert('wx.error' + str);
    });

    wx.ready(function () {
        $(".list-group-item").click(function(){
            var url='../../sendmessage/{{ device_type }}/{{ device_id }}/' + this.id;
            alert(url)
            $.ajax({
                url:url,
                type:'POST',
                success:function(result){
                    alert(result);
                }
            });
        })
    });
</script>
</html>